//
//  Camera.cpp
//  EidoTron
//
//  Created by Luca Di Franco on 10/05/11.
//  Copyright 2011 Luca Di Franco. All rights reserved.
//

#include "Camera.h"

#include <SDL_opengl.h>

Camera::Camera(float* positionFromParent)
{
	camPosition[0] = positionFromParent[0];
	camPosition[1] = positionFromParent[1];
	camPosition[2] = positionFromParent[2];
}

Camera::~Camera()
{ }

void Camera::renderEntity()
{
	float parentTransMatrix[16];
	glGetFloatv(GL_MODELVIEW_MATRIX, parentTransMatrix);
	float cameraTransMatrix[16];
	glTranslatef(camPosition[0], camPosition[1], camPosition[2]);
	glGetFloatv(GL_MODELVIEW_MATRIX, cameraTransMatrix);
	glLoadIdentity();
	gluLookAt(cameraTransMatrix[12], cameraTransMatrix[13], cameraTransMatrix[14], parentTransMatrix[12], parentTransMatrix[13], parentTransMatrix[14], 0.0f, 1.0f, 0.0f);
}

float* Camera::minMaxVal()
{
	return NULL;
}